/*
 * Copyright (c) 2010-2020 Belledonne Communications SARL.
 *
 * This file is part of linphone-android
 * (see https://www.linphone.org).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.newlink.building.activities.main.viewmodels

import android.net.Uri
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.newlink.building.utils.Module_Phone_Event
import org.linphone.core.*

class Module_Phone_SharedMainViewModel : ViewModel() {
    val toggleDrawerEvent = MutableLiveData<Module_Phone_Event<Boolean>>()
    val hideNavigationBar = MutableLiveData<Boolean>()

    val layoutChangedEvent = MutableLiveData<Module_Phone_Event<Boolean>>()
    val refreshDataCommandEvent = MutableLiveData<Module_Phone_Event<Boolean>>()
    var isSlidingPaneSlideable = MutableLiveData<Boolean>()
    val closeSlidingPaneEvent = MutableLiveData<Module_Phone_Event<Boolean>>()
    val userLogoutEvent = MutableLiveData<Module_Phone_Event<Boolean>>()

    /* Call history */

//    val selectedCallLogGroup = MutableLiveData<GroupedCallLogData>()

    /* Chat */

    val chatRoomFragmentOpenedEvent: MutableLiveData<Module_Phone_Event<Boolean>> by lazy {
        MutableLiveData<Module_Phone_Event<Boolean>>()
    }

    val selectedChatRoom = MutableLiveData<ChatRoom>()
    var destructionPendingChatRoom: ChatRoom? = null

    val selectedGroupChatRoom = MutableLiveData<ChatRoom>()

    val filesToShare = MutableLiveData<ArrayList<String>>()

    val textToShare = MutableLiveData<String>()

    val messageToForwardEvent: MutableLiveData<Module_Phone_Event<ChatMessage>> by lazy {
        MutableLiveData<Module_Phone_Event<ChatMessage>>()
    }

    val isPendingMessageForward = MutableLiveData<Boolean>()

    val contentToOpen = MutableLiveData<Content>()

    var createEncryptedChatRoom: Boolean = false

    val chatRoomParticipants = MutableLiveData<ArrayList<Address>>()

    var chatRoomSubject: String = ""

    // When using keyboard to share gif or other, see RichContentReceiver & RichEditText classes
    val richContentUri = MutableLiveData<Module_Phone_Event<Uri>>()

    /* Contacts */

    val contactFragmentOpenedEvent: MutableLiveData<Module_Phone_Event<Boolean>> by lazy {
        MutableLiveData<Module_Phone_Event<Boolean>>()
    }

//    val selectedContact = MutableLiveData<ContactEntity>()

    // For correct animations directions
    val updateContactsAnimationsBasedOnDestination: MutableLiveData<Module_Phone_Event<Int>> by lazy {
        MutableLiveData<Module_Phone_Event<Int>>()
    }

    /* Accounts */

    val accountRemoved = MutableLiveData<Boolean>()

    val accountSettingsFragmentOpenedEvent: MutableLiveData<Module_Phone_Event<Boolean>> by lazy {
        MutableLiveData<Module_Phone_Event<Boolean>>()
    }

    val jumpToDialHomePage: MutableLiveData<Module_Phone_Event<Boolean>> by lazy {
        MutableLiveData<Module_Phone_Event<Boolean>>()
    }

    val jumpToSettingsPage: MutableLiveData<Module_Phone_Event<Boolean>> by lazy {
        MutableLiveData<Module_Phone_Event<Boolean>>()
    }

    val exitApplication: MutableLiveData<Module_Phone_Event<Boolean>> by lazy {
        MutableLiveData<Module_Phone_Event<Boolean>>()
    }

    /* Call */

    var pendingCallTransfer: Boolean = false

    /* Dialer */

    var dialerUri: String = ""

    // For correct animations directions
    val updateDialerAnimationsBasedOnDestination: MutableLiveData<Module_Phone_Event<Int>> by lazy {
        MutableLiveData<Module_Phone_Event<Int>>()
    }
}
